package com.controller.admin;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.entity.Help;
import com.service.HelpService;
import com.vo.LayuiPageVo;

@Controller
/*后台校园互助管理 */
public class AdmHelpController {
	@Autowired 
	private HelpService helpService;
    
    /**
     *后台管理界面，查看审核通过的互助表
     * **/
    @GetMapping("/con/audhelp")
    public String AudHelp (){
        return "/admin/Help/AudHelp";
    }
    
    /**
     *后台管理界面，查看审核未通过的互助表
     * **/
    @GetMapping("/con/Unaudhelp")
    public String UnAudHelp (){
        return "/admin/Help/UnAudHelp";
    }
    
    /**
     * 后台分页查看帮助列表
     * 1.前端传入页码、分页数量
     * 2.查询分页数据
     */
    @ResponseBody
    @GetMapping("/help/queryall")
    public LayuiPageVo queryAllCarpools(int limit, int page) {
        List<Help> Helps = helpService.queryAllHelps((page - 1) * limit, limit);
        Integer dataNumber = helpService.LookHelpCount();
        return new LayuiPageVo("",0,dataNumber,Helps);
    }
    /**
     * 后台分页查看帮助列表
     * 1.前端传入页码、分页数量
     * 2.查询分页数据
     */
    @ResponseBody
    @GetMapping("/unhelp/queryall")
    public LayuiPageVo queryAllUnCarpools(int limit, int page) {
        List<Help> Helps = helpService.queryAllUnHelps((page - 1) * limit, limit);
        Integer dataNumber = helpService.LookUnHelpCount();
        return new LayuiPageVo("",0,dataNumber,Helps);
    }
    
}
